package solved;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;

/*
ID:		liluyan1
LANG:	JAVA
TASK:	money
*/
public class money {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("money.in"));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"money.out")));
		new money().solve(f, out);
		out.close();
		System.exit(0);
	}
	
	private int V, N;
	
	private void solve(BufferedReader f, PrintWriter out) throws IOException {
		int[] a = read(f, 2);
		V = a[0];
		N = a[1];
		int[] m = read2(f, V);
		Arrays.sort(m);
		
		long[] dp = new long[N+1];
		dp[0] = 1;
		for (int i=0; i<V; i++) {
			for (int j=0; j+m[i]<=N; j++) {
				dp[j+m[i]] += dp[j];
			}
		}
		
		out.println(dp[N]);
	}
	
	public int read(BufferedReader f) throws IOException {
		return Integer.parseInt(f.readLine());
	}
	
	public int[] read(BufferedReader f, int N) throws IOException {
		String[] t = f.readLine().split(" ");
		int[] a = new int[N];
		for (int i=0; i<N; i++) {
			a[i] = Integer.parseInt(t[i]);
		}
		return a;
	}
	
	public int[] read2(BufferedReader f, int N) throws IOException {
		StringBuilder sb = new StringBuilder();
		String line = null;
		while ((line = f.readLine()) != null) {
			sb.append(line + " ");
		}
		
		String[] t = sb.toString().split(" ");
		int[] a = new int[N];
		int i = 0;
		for (String s : t) {
			if (s.length()>0) {
				a[i] = Integer.parseInt(s);
				i++;
			}
		}
		return a;
	}
}
